# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=glib-networking

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.40.1
pkgrel=1
pkgdesc="Network-related GIO modules for glib (mingw-w64)"
arch=(any)
url="http://ftp.gnome.org/pub/GNOME/sources/libsoup"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" "${MINGW_PACKAGE_PREFIX}-gdk-pixbuf2" "intltool")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
    "${MINGW_PACKAGE_PREFIX}-libgcrypt"
    "${MINGW_PACKAGE_PREFIX}-gnutls"
    "${MINGW_PACKAGE_PREFIX}-glib2"
    "${MINGW_PACKAGE_PREFIX}-gettext"
    "${MINGW_PACKAGE_PREFIX}-p11-kit"
    "${MINGW_PACKAGE_PREFIX}-xz")
options=('staticlibs' 'strip')
source=("http://ftp.gnome.org/pub/gnome/sources/${_realname}/${pkgver%.*}/${_realname}-$pkgver.tar.xz"
    0001-dont-overwrite-prefix-remain-relative.mingw.patch)
md5sums=('505f8a40fad96944b292d1c48f4e5569'
         '6c55845f6c66fc8401915d1561b6872d')

prepare() {
  cd "$srcdir/${_realname}-$pkgver"
  patch -p1 -i ${srcdir}/0001-dont-overwrite-prefix-remain-relative.mingw.patch
  #autoreconf -fi
}

build() {
    mkdir -p "${srcdir}/build-${MINGW_CHOST}"
    cd "${srcdir}/build-${MINGW_CHOST}"
    "${srcdir}"/${_realname}-$pkgver/configure \
      --prefix=${MINGW_PREFIX} \
      --build=${MINGW_CHOST} \
      --host=${MINGW_CHOST} \
      --without-libproxy \
      --without-gnome-proxy \
      --without-ca-certificates
    make
}

package() {
    cd "${srcdir}/build-${MINGW_CHOST}"
    make DESTDIR="$pkgdir" install
    mv ${pkgdir}/lib ${pkgdir}${MINGW_PREFIX}/
    rm -f ${pkgdir}${MINGW_PREFIX}/lib/gio/modules/*.a
}
